/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package program.gui.model;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;
import program.beans.Bill;

/**
 * TableModel for table which views bills with columns 'Hinzugefügt am',
 * 'Firma', 'Rechnungsdatum', 'Gesamtbruttobetrag' and 'Nettobetrag'
 *
 * Responsible: Patrick
 */
public class ViewBillTableModel extends AbstractTableModel {

    private String[] tableHeaders = {"Hinzugefügt am", "Firma", "Rechnungsdatum", "Gesamtbruttobetrag", "Kategorie"};
    private ArrayList<Bill> bills;

    public ViewBillTableModel(ArrayList<Bill> bills) {
        this.bills = bills;
    }

    @Override
    public int getRowCount() {
        return bills.size();
    }

    @Override
    public int getColumnCount() {
        return tableHeaders.length;
    }

    @Override
    public String getColumnName(int column) {
        return tableHeaders[column];
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Bill b = bills.get(rowIndex);
        return b;
    }
}
